home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / pascal / swag / copymove.swg / 0013_Rename File #1.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-05-28  |  597 b   |  24 lines

  1. {
  2. > Does anybody know how to do a "fast" move of a File?
  3. > ie: not copying it but just moving the FAT Record
  4.  
  5.   Yup.  In Pascal you can do it With the Rename command.  The Format is:
  6.  
  7.    Rename (Var F; NewName : String)
  8.  
  9. where F is a File Variable of any Type.
  10.  
  11. to move a File Really fast, and to avoid having to copy it somewhere first and
  12. then deleting the original, do this:
  13. }
  14.  
  15. Procedure MoveIt;  {No error checking done}
  16. Var
  17.    F : File;
  18.    FName : String;
  19.    NName : String;
  20. begin
  21.    Assign (F, FName);
  22.    NName:= {new directory / File name}
  23.    Rename (F, NName);
  24. End.